package com.spzx.product.api.service;

import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.constant.ServiceNameConstants;
import com.spzx.common.core.domain.R;
import com.spzx.product.api.domain.vo.SkuLockVo;
import com.spzx.product.api.factory.RemoteSkuStockFallbackFactory;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

import java.util.List;

@FeignClient(contextId = "remoteSkuStocktService",value = ServiceNameConstants.PRODUCT_SERVICE, fallbackFactory = RemoteSkuStockFallbackFactory.class)
public interface RemoteSkuStocktService{

    @Operation(summary = "供微服务远程调用的方法,检查和锁库存")
    @PostMapping("/skuStock/checkAndLock/Stock{tradeNo}")
    public R<String> checkAndLockStock(@PathVariable("tradeNo") String tradeNo, @RequestBody List<SkuLockVo> skuLockVoList,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
